<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script type="text/javascript">
	$(function(){
		$('#user_login_logForm').form({
					url:'${pageContext.request.contextPath}/userAction!login.action',
						success:function(r){
							var obj= jQuery.parseJSON(r);
					    	if(obj.success){
							 $('#user_login_loginDialog').dialog('close');
							 $.messager.show({
							   	title:'提示',
							 	msg:obj.msg
							 });
							}else{
								$.messager.show({
									title:'提示',
								  	msg:obj.msg
								});
							}
						}
					});
					//可查jquery手册，增加回车功能 就提交  必须将功能写成来 如登录功能，注册功能写法就不行
			  $('#user_login_logForm input').bind('keyup',function(event){
				if(event.keyCode=='13'){
					$('#user_login_logForm').submit();
			 }
		});
		window.setTimeout(function(){
			$('#user_login_logForm input[name=name]').focus();
		},0);
	});
</script>

<div id="user_login_loginDialog" class="easyui-dialog" style="width:260px;height:130px"
	 data-options="title:'登录',modal:true,closable:false,buttons:[{
			text:'注册',
			iconCls:'icon-edit',
			handler:function(){
				$('#user_reg_regDialog').dialog('open');
			}
			},{
				text:'登录',
				iconCls:'icon-help',
				handler:function(){
				 	$('#user_login_logForm').submit();
				}
			}]">
			<form id="user_login_logForm" method="post">
			<table>
				<tr>
					<th>登录名</th>
					<th><input type="text" name="name" class="easyui-validatebox" data-options="required:true,missingMessage:'请输入用户名！'" /></th>
				</tr>
				<tr>
					<th>密码</th>
					<th><input type="password" name="password" class="easyui-validatebox" data-options="required:true,missingMessage:'请输入用户密码！'" /></th>
				</tr>
			</table>
			</form>
</div>
